import java.io.*;
import java.util.Scanner;
import java.util.StringTokenizer;


public class BP_BTFNT {
    String branchStatement;
    int correct =0;
    int incorrect = 0;
    class branch_trace {
        char BIA;
        char BTA;
        boolean br_outcome;
        static final int NOT_TAKEN = 0;
        static final int TAKEN = 1;
    }

    public BP_BTFNT() {
    }
    public static void main(String[] args) {

     // temp variables declaration
        int outcome, prediction;
        String BIA, BTA;
        String[] items;
        // end of declaration
        
        String inputFile = "input.txt";
        if(args.length == 1) {
        	inputFile = (args[0]);
        }

        BP_BTFNT schd = new BP_BTFNT();
        String str;

        // Read Input file...
        Scanner s = null;
        try {
            s = new Scanner(new BufferedReader(
                    new FileReader(inputFile)));
        } catch (FileNotFoundException e) {
            //e.printStackTrace();
            System.out.println("read file...  " + 
            "input File not found exception");
            System.exit(0);
        }
        if(s == null) System.exit(0);
        while(s.hasNext()) {
            str = s.nextLine();
            items = str.split("\t");
            BIA = items[0].trim();
            BTA = items[1].trim();
            outcome = (items[2].charAt(0) == '0' ? 
                    branch_trace.NOT_TAKEN:branch_trace.TAKEN);


            //System.out.print(BIA + " " +BTA  + " " + outcome +":: ");
            if( BTA.length() > BIA.length() ) {
                prediction = branch_trace.NOT_TAKEN;
            }else if(BTA.length() < BIA.length()) {
                prediction = branch_trace.TAKEN;
            }
            else {
                if(BTA.compareTo(BIA)>0)
                    prediction = branch_trace.NOT_TAKEN;
                else if(BTA.compareTo(BIA)<0)
                    prediction = branch_trace.TAKEN;
                else prediction = branch_trace.TAKEN;
            }
            //System.out.print(prediction);
            //System.out.println(" ");
            
            if(prediction == outcome) schd.correct++;
            else schd.incorrect++;
        }
        float result = ((float)schd.correct/(float)(schd.correct+schd.incorrect))*100;
        System.out.format("%.3f", result);
        s.close();
    }

}
